package com.winai.launcher.BroadcastReceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.winai.launcher.manager.UpgradeWindowManager;
import com.winai.launcher.manager.WindowTipManager;

/**
 * 作者：康少
 * 时间：2020/6/29 0029
 * 说明：实体按键监听
 */
public class KeyDownReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        //你自己先把 reasons == homekey 和 长按homekey 排除，剩下的做下面的处理
        String reason = intent.getStringExtra("reason");
        if (intent.getAction().equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
            if (reason != null) {
                if (reason.equalsIgnoreCase("globalactions")) {
                    //监听电源长按键的方法：
                    WindowTipManager.getInstance(context).dismissTip();
                    UpgradeWindowManager.getInstance(context, null).dismissTip();

                }
            }
        }
    }
}
